<?php
/* 
 * Contains Products and their Quantities
 */
class CartItem {
  private $product;
  private $quantity;

  function __construct($product, $quantity) {
    $this->product = $product;
    $this->quantity = $quantity;
  }

  public function getProduct() {
    return $this->product;
  }

  public function setProduct($product) {
    $this->product = $product;
  }

  public function getQuantity() {
    return $this->quantity;
  }

  public function setQuantity($quantity) {
    $this->quantity = $quantity;
  }

  public function getTotal() {
    $retVal = 0.00;
    if(!empty($this->product) && !empty($this->quantity) ) {
      $price=$this->product->getPrice();      
      $retVal = number_format((float)$price*$this->quantity, 2);
    }
    return $retVal;
  }


}
?>
